﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.Util;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using System.IO;

namespace Com.CMS263.Web.manage.BaoInfoManage
{
    public partial class bao_edit : System.Web.UI.Page
    {
        BaoInfoBLL pbll = new BaoInfoBLL();
        public BaoInfo ab = new BaoInfo();
        public int page = 0;
        public int id;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
               
                BindData();
            }
            page = Convert.ToInt32(Request["page"]);
           
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request["id"]);
            ab = (BaoInfo)pbll.FindModelById("BaoInfo", id);
            ab.FlagStatus = Convert.ToBoolean(Convert.ToInt32(Request["FlagStatus"]));
            ab.FlagStatusMessage = Request["Message"];
            pbll.entity= ab;
            if (pbll.UpDate())
            {
                StringUtil.Alert("修改成功", "bao_edit.aspx?id="+id+"&page="+page);
            }


        }
        public void BindData()
        {
            id = Convert.ToInt32(Request["id"]);
            if (id <= 0)
            {
                StringUtil.Alert("抱歉，没有找到相关数据", "bao_list.aspx");
            }
            ab = (BaoInfo)pbll.FindModelById("BaoInfo", id);
        }
    }
}
